package com.zhucan.account.infrastructure.db.entity;

import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * author: zhuCan
 * date: 2020/8/4 19:52
 * description:
 */
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
public class AccountPO {

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  @Column(name = "identity_card", nullable = false, length = 20)
  private String identityCard;

  @Column(name = "account", nullable = false, length = 15)
  private String account;

  @Column(name = "password", length = 15)
  private String password;

  @Column(name = "customer_name", nullable = false, length = 10)
  private String customerName;

  @Column(name = "cellphone", columnDefinition = "char(11)")
  private String cellphone;

  @Column(name = "address", length = 50)
  private String address;

  @Column(name = "job", length = 20)
  private String job;

  @Column(name = "suspend", columnDefinition = "tinyint(1) default 0")
  private Boolean suspend;

  @Column(name = "amount", columnDefinition = "decimal(15,6)")
  private BigDecimal amount;

  @Column(name = "create_time", nullable = false, updatable = false)
  @CreatedDate
  private LocalDateTime createTime;

  @Column(name = "update_time", nullable = false)
  @LastModifiedDate
  private LocalDateTime updateTime;

}
